<!DOCTYPE html>
<html lang="en">
<head>
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta charset="UTF-8">
    <title>5 repeat循环和tab切换</title>
    <style>
        li{
            float: left;
            margin-right:10px;
            padding:10px;
            list-style: none;
        }
        li.bg{
            background-color: red;
            color:#fff
        }
    </style>
    <script src="../angular-1.5.8/angular.js"></script>
</head>
<body ng-app="myApp" ng-controller="myCtrl">

<input type="checkbox" ng-model="check" id="app1">
<label for="app1">点击启动超级变换形态</label>
<ul>
    <!--点击换色-->
    <li ng-repeat="item in arr" ng-class="{bg:$odd&&check||$even&&!check}">
        <p>姓名:{{item.name}}</p>
        <p>年龄:{{item.age}}</p>
        <p>性别:{{item.sex}}</p>
        <p>爱好:{{item.hobby}}</p>
        <p>爱好2:{{item.love}}</p>
    </li>
</ul>
<!--<table>-->
    <!--<tr>-->
        <!--<th ng-repeat="item.obj in arr.item">{{obj}}</th>-->
    <!--</tr>-->
<!--</table>-->
<script>
    var app = angular.module("myApp",[])
    app.controller("myCtrl",function ($scope) {
//        当有两个完全一样的东西时,需要在 repeat 的里面加上 track by $index
        $scope.arr=[
            {name:"热一",age:26,sex:"女",hobby:"电影",love:"电视"},
            {name:"热二",age:25,sex:"女",hobby:"电影",love:"电视"},
            {name:"热三",age:24,sex:"女",hobby:"电影",love:"电视"},
            {name:"热四",age:23,sex:"女",hobby:"电影",love:"电视"},
            {name:"热五",age:22,sex:"女",hobby:"电影",love:"电视"},
            {name:"热六",age:21,sex:"女",hobby:"电影",love:"电视"},
            {name:"热七",age:20,sex:"女",hobby:"电影",love:"电视"},
            {name:"热巴",age:19,sex:"女",hobby:"电影",love:"电视"}
        ]
    })
</script>
</body>
</html>